package dkbta.processing.tasks;

import dkbta.ontology.elements.ElementDef;
import dkbta.processing.Patient;
import dkbta.processing.WorkQueue;

/**
 * A task that is used for the actual receiving of remote elements. It is merely meant to
 * be an observable, observed by its parent tasks who are notified once the remote element
 * has been received.<br>
 * <br>
 * The task is associated with a single patient is never primary.
 * 
 * @author Uri Kanonov
 */
public class RemoteTask extends Task{

	/**
	 * Initializes a remote computation task.
	 * 
	 * @param element The associated element
	 * @param patient The patient associated with the task
	 */
	public RemoteTask(ElementDef element, Patient patient){
		super(element, patient.getPatientId(), false);
	}

	/**
	 * Remote tasks are automatically performed when the relevant data arrives so this
	 * method should never be called
	 */
	@Override
	public boolean performTask(WorkQueue wq){
		throw new UnsupportedOperationException(
				"Remote tasks are automatically performed when the relevant data arrives");
	}	

	@Override
	public String toString(){
		return "Remote: PID = " + _patientId + ", " + element + " "
				+ ((isPrimary) ? "[PRIMARY]" : "");
	}
}
